package cn.lsc.controller;

import cn.lsc.domain.User;
import cn.lsc.feign.UserFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private UserFeignService userFeignService;
    @GetMapping("/findById/{id}")
    //@SentinelResource(value = "user-service-findById",fallback = "fuseDegradation")
    public User findById(@PathVariable("id")Long id){
        return userFeignService.findById(id);
    }

//    public User fuseDegradation(@PathVariable("id")Long id,Throwable e){
//        e.printStackTrace();
//        return new User(-1L,"触发熔断了","服务暂时不可用！");
//    }
}
